I am trying to apply a dynamic trigger which runs some code before the user closes the module but often get repeat calls and also get the following error:
Module m = current
Trigger closeTrigger = null
void deleteTrig ()
{
ack "CALL CLOSE TRIGGER"
if(!null closeTrigger ) {
delete closeTrigger
ack "DELETED CLOSE TRIGGER"
}
}
bool doCloseTrig (Trigger t)
{
if(confirm "DO YOU WANT TO RUN THE CODE NOW?") {
ack "RUN CODE"
deleteTrig ()
}
return true
}
closeTrigger = trigger(module, close, 10, doCloseTrig)
Martin_Hunter - Tue Nov 02 14:43:49 EDT 2010 |
Re: Dynamic Triggers Running your code (on DOORS 9.3) I noticed that the module was closed at the point when ack "CALL CLOSE TRIGGER" executed. And DXL Help describes a dynamic trigger as: "Not stored; persists only for the loaded lifetime of the project or module that defines it." So would it be that you are getting error message because the module is already closed and thus the trigger has already been deleted by DOORS? |
Re: Dynamic Triggers <1> forget your global declared variable 'closeTrigger' and have function deleteTrig(Trigger &t) take an input Trigger variable from function doCloseTrigger. <2> failing that, it would be prudent to set closeTrigger = null after you delete it. <3> doCloseTrig should only return(true) when you WANT to close the module, otherwise it should return(false). I'm guessing your issue is that you have more than one such trigger running off the same instance of the code, ant closeTrigger is getting set to null before the next isntance of the trigger fires.
|